\(\int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx\) [768]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 43, antiderivative size = 141 \[ \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx=\frac {(3 i A+B) \text {arctanh}\left (\frac {\sqrt {c-i c \tan (e+f x)}}{\sqrt {2} \sqrt {c}}\right )}{4 \sqrt {2} a \sqrt {c} f}-\frac {3 i A+B}{4 a f \sqrt {c-i c \tan (e+f x)}}+\frac {i A-B}{2 a f (1+i \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \]

[Out]

1/8*(3*I*A+B)*arctanh(1/2*(c-I*c*tan(f*x+e))^(1/2)*2^(1/2)/c^(1/2))/a/f*2^(1/2)/c^(1/2)+1/4*(-3*I*A-B)/a/f/(c-
I*c*tan(f*x+e))^(1/2)+1/2*(I*A-B)/a/f/(c-I*c*tan(f*x+e))^(1/2)/(1+I*tan(f*x+e))

Rubi [A] (verified)

Time = 0.26 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.116, Rules used = {3669, 79, 53, 65, 214} \[ \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx=\frac {(B+3 i A) \text {arctanh}\left (\frac {\sqrt {c-i c \tan (e+f x)}}{\sqrt {2} \sqrt {c}}\right )}{4 \sqrt {2} a \sqrt {c} f}+\frac {-B+i A}{2 a f (1+i \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}}-\frac {B+3 i A}{4 a f \sqrt {c-i c \tan (e+f x)}} \]

[In]

Int[(A + B*Tan[e + f*x])/((a + I*a*Tan[e + f*x])*Sqrt[c - I*c*Tan[e + f*x]]),x]

[Out]

(((3*I)*A + B)*ArcTanh[Sqrt[c - I*c*Tan[e + f*x]]/(Sqrt[2]*Sqrt[c])])/(4*Sqrt[2]*a*Sqrt[c]*f) - ((3*I)*A + B)/
(4*a*f*Sqrt[c - I*c*Tan[e + f*x]]) + (I*A - B)/(2*a*f*(1 + I*Tan[e + f*x])*Sqrt[c - I*c*Tan[e + f*x]])

Rule 53

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(a + b*x)^(m + 1)*((c + d*x)^(n + 1
)/((b*c - a*d)*(m + 1))), x] - Dist[d*((m + n + 2)/((b*c - a*d)*(m + 1))), Int[(a + b*x)^(m + 1)*(c + d*x)^n,
x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] &&  !(LtQ[n, -1] && (EqQ[a, 0] || (NeQ[
c, 0] && LtQ[m - n, 0] && IntegerQ[n]))) && IntLinearQ[a, b, c, d, m, n, x]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 79

Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(-(b*e - a*f
))*(c + d*x)^(n + 1)*((e + f*x)^(p + 1)/(f*(p + 1)*(c*f - d*e))), x] - Dist[(a*d*f*(n + p + 2) - b*(d*e*(n + 1
) + c*f*(p + 1)))/(f*(p + 1)*(c*f - d*e)), Int[(c + d*x)^n*(e + f*x)^(p + 1), x], x] /; FreeQ[{a, b, c, d, e,
f, n}, x] && LtQ[p, -1] && ( !LtQ[n, -1] || IntegerQ[p] ||  !(IntegerQ[n] ||  !(EqQ[e, 0] ||  !(EqQ[c, 0] || L
tQ[p, n]))))

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a c) \text {Subst}\left (\int \frac {A+B x}{(a+i a x)^2 (c-i c x)^{3/2}} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {i A-B}{2 a f (1+i \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}}+\frac {((3 A-i B) c) \text {Subst}\left (\int \frac {1}{(a+i a x) (c-i c x)^{3/2}} \, dx,x,\tan (e+f x)\right )}{4 f} \\ & = -\frac {3 i A+B}{4 a f \sqrt {c-i c \tan (e+f x)}}+\frac {i A-B}{2 a f (1+i \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}}+\frac {(3 A-i B) \text {Subst}\left (\int \frac {1}{(a+i a x) \sqrt {c-i c x}} \, dx,x,\tan (e+f x)\right )}{8 f} \\ & = -\frac {3 i A+B}{4 a f \sqrt {c-i c \tan (e+f x)}}+\frac {i A-B}{2 a f (1+i \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}}+\frac {(3 i A+B) \text {Subst}\left (\int \frac {1}{2 a-\frac {a x^2}{c}} \, dx,x,\sqrt {c-i c \tan (e+f x)}\right )}{4 c f} \\ & = \frac {(3 i A+B) \text {arctanh}\left (\frac {\sqrt {c-i c \tan (e+f x)}}{\sqrt {2} \sqrt {c}}\right )}{4 \sqrt {2} a \sqrt {c} f}-\frac {3 i A+B}{4 a f \sqrt {c-i c \tan (e+f x)}}+\frac {i A-B}{2 a f (1+i \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \\ \end{align*}

Mathematica [A] (verified)

Time = 3.91 (sec) , antiderivative size = 113, normalized size of antiderivative = 0.80 \[ \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx=\frac {\frac {\sqrt {2} (3 i A+B) \text {arctanh}\left (\frac {\sqrt {c-i c \tan (e+f x)}}{\sqrt {2} \sqrt {c}}\right )}{\sqrt {c}}+\frac {-2 A+6 i B+(-6 i A-2 B) \tan (e+f x)}{(-i+\tan (e+f x)) \sqrt {c-i c \tan (e+f x)}}}{8 a f} \]

[In]

Integrate[(A + B*Tan[e + f*x])/((a + I*a*Tan[e + f*x])*Sqrt[c - I*c*Tan[e + f*x]]),x]

[Out]

((Sqrt[2]*((3*I)*A + B)*ArcTanh[Sqrt[c - I*c*Tan[e + f*x]]/(Sqrt[2]*Sqrt[c])])/Sqrt[c] + (-2*A + (6*I)*B + ((-
6*I)*A - 2*B)*Tan[e + f*x])/((-I + Tan[e + f*x])*Sqrt[c - I*c*Tan[e + f*x]]))/(8*a*f)

Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 121, normalized size of antiderivative = 0.86

method result size
derivativedivides \(\frac {2 i c \left (-\frac {-i B +A}{4 c \sqrt {c -i c \tan \left (f x +e \right )}}+\frac {\frac {\left (\frac {i B}{4}+\frac {A}{4}\right ) \sqrt {c -i c \tan \left (f x +e \right )}}{\frac {c}{2}+\frac {i c \tan \left (f x +e \right )}{2}}+\frac {\left (\frac {3 A}{2}-\frac {i B}{2}\right ) \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {c -i c \tan \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {c}}\right )}{2 \sqrt {c}}}{4 c}\right )}{f a}\) \(121\)
default \(\frac {2 i c \left (-\frac {-i B +A}{4 c \sqrt {c -i c \tan \left (f x +e \right )}}+\frac {\frac {\left (\frac {i B}{4}+\frac {A}{4}\right ) \sqrt {c -i c \tan \left (f x +e \right )}}{\frac {c}{2}+\frac {i c \tan \left (f x +e \right )}{2}}+\frac {\left (\frac {3 A}{2}-\frac {i B}{2}\right ) \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {c -i c \tan \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {c}}\right )}{2 \sqrt {c}}}{4 c}\right )}{f a}\) \(121\)

[In]

int((A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^(1/2)/(a+I*a*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

2*I/f/a*c*(-1/4/c*(A-I*B)/(c-I*c*tan(f*x+e))^(1/2)+1/4/c*((1/4*I*B+1/4*A)*(c-I*c*tan(f*x+e))^(1/2)/(1/2*c+1/2*
I*c*tan(f*x+e))+1/2*(3/2*A-1/2*I*B)*2^(1/2)/c^(1/2)*arctanh(1/2*(c-I*c*tan(f*x+e))^(1/2)*2^(1/2)/c^(1/2))))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 355 vs. \(2 (108) = 216\).

Time = 0.26 (sec) , antiderivative size = 355, normalized size of antiderivative = 2.52 \[ \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx=\frac {{\left (\sqrt {\frac {1}{2}} a c f \sqrt {-\frac {9 \, A^{2} - 6 i \, A B - B^{2}}{a^{2} c f^{2}}} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (\frac {{\left (\sqrt {2} \sqrt {\frac {1}{2}} {\left (a f e^{\left (2 i \, f x + 2 i \, e\right )} + a f\right )} \sqrt {\frac {c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}} \sqrt {-\frac {9 \, A^{2} - 6 i \, A B - B^{2}}{a^{2} c f^{2}}} + 3 i \, A + B\right )} e^{\left (-i \, f x - i \, e\right )}}{2 \, a f}\right ) - \sqrt {\frac {1}{2}} a c f \sqrt {-\frac {9 \, A^{2} - 6 i \, A B - B^{2}}{a^{2} c f^{2}}} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (-\frac {{\left (\sqrt {2} \sqrt {\frac {1}{2}} {\left (a f e^{\left (2 i \, f x + 2 i \, e\right )} + a f\right )} \sqrt {\frac {c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}} \sqrt {-\frac {9 \, A^{2} - 6 i \, A B - B^{2}}{a^{2} c f^{2}}} - 3 i \, A - B\right )} e^{\left (-i \, f x - i \, e\right )}}{2 \, a f}\right ) - \sqrt {2} {\left (2 \, {\left (i \, A + B\right )} e^{\left (4 i \, f x + 4 i \, e\right )} - {\left (-i \, A - 3 \, B\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - i \, A + B\right )} \sqrt {\frac {c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{8 \, a c f} \]

[In]

integrate((A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^(1/2)/(a+I*a*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/8*(sqrt(1/2)*a*c*f*sqrt(-(9*A^2 - 6*I*A*B - B^2)/(a^2*c*f^2))*e^(2*I*f*x + 2*I*e)*log(1/2*(sqrt(2)*sqrt(1/2)
*(a*f*e^(2*I*f*x + 2*I*e) + a*f)*sqrt(c/(e^(2*I*f*x + 2*I*e) + 1))*sqrt(-(9*A^2 - 6*I*A*B - B^2)/(a^2*c*f^2))
+ 3*I*A + B)*e^(-I*f*x - I*e)/(a*f)) - sqrt(1/2)*a*c*f*sqrt(-(9*A^2 - 6*I*A*B - B^2)/(a^2*c*f^2))*e^(2*I*f*x +
 2*I*e)*log(-1/2*(sqrt(2)*sqrt(1/2)*(a*f*e^(2*I*f*x + 2*I*e) + a*f)*sqrt(c/(e^(2*I*f*x + 2*I*e) + 1))*sqrt(-(9
*A^2 - 6*I*A*B - B^2)/(a^2*c*f^2)) - 3*I*A - B)*e^(-I*f*x - I*e)/(a*f)) - sqrt(2)*(2*(I*A + B)*e^(4*I*f*x + 4*
I*e) - (-I*A - 3*B)*e^(2*I*f*x + 2*I*e) - I*A + B)*sqrt(c/(e^(2*I*f*x + 2*I*e) + 1)))*e^(-2*I*f*x - 2*I*e)/(a*
c*f)

Sympy [F]

\[ \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx=- \frac {i \left (\int \frac {A}{\sqrt {- i c \tan {\left (e + f x \right )} + c} \tan {\left (e + f x \right )} - i \sqrt {- i c \tan {\left (e + f x \right )} + c}}\, dx + \int \frac {B \tan {\left (e + f x \right )}}{\sqrt {- i c \tan {\left (e + f x \right )} + c} \tan {\left (e + f x \right )} - i \sqrt {- i c \tan {\left (e + f x \right )} + c}}\, dx\right )}{a} \]

[In]

integrate((A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))**(1/2)/(a+I*a*tan(f*x+e)),x)

[Out]

-I*(Integral(A/(sqrt(-I*c*tan(e + f*x) + c)*tan(e + f*x) - I*sqrt(-I*c*tan(e + f*x) + c)), x) + Integral(B*tan
(e + f*x)/(sqrt(-I*c*tan(e + f*x) + c)*tan(e + f*x) - I*sqrt(-I*c*tan(e + f*x) + c)), x))/a

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.01 \[ \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx=-\frac {i \, {\left (\frac {\sqrt {2} {\left (3 \, A - i \, B\right )} \sqrt {c} \log \left (-\frac {\sqrt {2} \sqrt {c} - \sqrt {-i \, c \tan \left (f x + e\right ) + c}}{\sqrt {2} \sqrt {c} + \sqrt {-i \, c \tan \left (f x + e\right ) + c}}\right )}{a} + \frac {4 \, {\left ({\left (-i \, c \tan \left (f x + e\right ) + c\right )} {\left (3 \, A - i \, B\right )} c - 4 \, {\left (A - i \, B\right )} c^{2}\right )}}{{\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{\frac {3}{2}} a - 2 \, \sqrt {-i \, c \tan \left (f x + e\right ) + c} a c}\right )}}{16 \, c f} \]

[In]

integrate((A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^(1/2)/(a+I*a*tan(f*x+e)),x, algorithm="maxima")

[Out]

-1/16*I*(sqrt(2)*(3*A - I*B)*sqrt(c)*log(-(sqrt(2)*sqrt(c) - sqrt(-I*c*tan(f*x + e) + c))/(sqrt(2)*sqrt(c) + s
qrt(-I*c*tan(f*x + e) + c)))/a + 4*((-I*c*tan(f*x + e) + c)*(3*A - I*B)*c - 4*(A - I*B)*c^2)/((-I*c*tan(f*x +
e) + c)^(3/2)*a - 2*sqrt(-I*c*tan(f*x + e) + c)*a*c))/(c*f)

Giac [F]

\[ \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx=\int { \frac {B \tan \left (f x + e\right ) + A}{{\left (i \, a \tan \left (f x + e\right ) + a\right )} \sqrt {-i \, c \tan \left (f x + e\right ) + c}} \,d x } \]

[In]

integrate((A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^(1/2)/(a+I*a*tan(f*x+e)),x, algorithm="giac")

[Out]

integrate((B*tan(f*x + e) + A)/((I*a*tan(f*x + e) + a)*sqrt(-I*c*tan(f*x + e) + c)), x)

Mupad [B] (verification not implemented)

Time = 9.29 (sec) , antiderivative size = 212, normalized size of antiderivative = 1.50 \[ \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c-i c \tan (e+f x)}} \, dx=\frac {B\,c-\frac {B\,\left (c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}{4}}{a\,f\,{\left (c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^{3/2}-2\,a\,c\,f\,\sqrt {c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}}+\frac {\frac {A\,\left (c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{4\,a\,f}-\frac {A\,c\,1{}\mathrm {i}}{a\,f}}{2\,c\,\sqrt {c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}-{\left (c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^{3/2}}-\frac {\sqrt {2}\,A\,\mathrm {atan}\left (\frac {\sqrt {2}\,\sqrt {c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}}{2\,\sqrt {-c}}\right )\,3{}\mathrm {i}}{8\,a\,\sqrt {-c}\,f}+\frac {\sqrt {2}\,B\,\mathrm {atanh}\left (\frac {\sqrt {2}\,\sqrt {c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}}{2\,\sqrt {c}}\right )}{8\,a\,\sqrt {c}\,f} \]

[In]

int((A + B*tan(e + f*x))/((a + a*tan(e + f*x)*1i)*(c - c*tan(e + f*x)*1i)^(1/2)),x)

[Out]

(B*c - (B*(c - c*tan(e + f*x)*1i))/4)/(a*f*(c - c*tan(e + f*x)*1i)^(3/2) - 2*a*c*f*(c - c*tan(e + f*x)*1i)^(1/
2)) + ((A*(c - c*tan(e + f*x)*1i)*3i)/(4*a*f) - (A*c*1i)/(a*f))/(2*c*(c - c*tan(e + f*x)*1i)^(1/2) - (c - c*ta
n(e + f*x)*1i)^(3/2)) - (2^(1/2)*A*atan((2^(1/2)*(c - c*tan(e + f*x)*1i)^(1/2))/(2*(-c)^(1/2)))*3i)/(8*a*(-c)^
(1/2)*f) + (2^(1/2)*B*atanh((2^(1/2)*(c - c*tan(e + f*x)*1i)^(1/2))/(2*c^(1/2))))/(8*a*c^(1/2)*f)